﻿#region Using directives

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

using Weazel.Toad.Application.Items;

#endregion

namespace Weazel.Toad.Application.Controls
{
  [ToolboxItem(true)]
  public partial class PropertiesPanel : UserControl
  {
    public PropertiesPanel()
    {
      InitializeComponent();

      Application.Instance.SelectedItemChanged += 
        new EventHandler<SelectedItemChangedEventArgs>(Application_SelectedItemChanged);
    }

    void Application_SelectedItemChanged(object sender, SelectedItemChangedEventArgs e)
    {
      ItemBase item = Application.Instance.SelectedItem;

      if (item == null)
      {
        propertyGrid.SelectedObject = null;
      }
      else
      {
        this.propertyGrid.SelectedObject = item;
      }
    }
  }
}
